<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
<script>
function setText()
{
    var oTxt=document.getElementById('txt1');

    oTxt.value='abcd';
}
</script>
</head>
<body>
<input id="txt1" type="text"  value='fff'/>
<input  type="button" value="改文字"  onclick="setText()" />
</body>
</html>